import 'package:flutter/material.dart';
import 'package:flutter_app/widget/BottomNavigationBarCustom.dart';
import '../widget/DrawerCustom.dart';
import '../model/post.dart';

class Home extends StatelessWidget {
  Widget _listItemBuilder(BuildContext context, int index) {
    return new Container(
      color: Colors.white,
      margin: EdgeInsets.all(10),
      child: new Column(
        children: [
          new Image.network(posts[index].imageUrl),
          new SizedBox(height: 16),
          new Text(
            posts[index].title,
            style: Theme.of(context).textTheme.headline6,
          ),
          new Text(
            posts[index].author,
            style: Theme.of(context).textTheme.subtitle1,
          ),
          new SizedBox(height: 16)
        ],
      ),
    );
  }



  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey[100],
      appBar: new AppBar(
        title: new Text('PET'),
        centerTitle: true,
      ),
      body: new ListView.builder(
        itemBuilder: _listItemBuilder,
        itemCount: posts.length,
      ),
      drawer: new DrawerCustom(),
      bottomNavigationBar: new BottomNavigationBarCustom(),
    );
  }
}
